package com.leruan.aasimp.entity;

public enum PartTypeEnumEntity {
    // 1:发动机配件系列,2:制动零部件系列,3:汽车电器系列,4:汽车底盘,5:汽车车身
	ENGINE(1), BRAKING(2),ELECTRICAL(3),FLOOR(4),BODY(5);

    private int value;
    PartTypeEnumEntity(int value){
    	this.value = value;
    }

    public static PartTypeEnumEntity valueOf(int value) {
    	PartTypeEnumEntity type = null;
        switch (value) {
        case 1:
            type = ENGINE;
            break;
        case 2:
            type = BRAKING;
            break;
        case 3:
            type = ELECTRICAL;
            break;
        case 4:
            type = FLOOR;
            break;
        case 5:
            type = BODY;
            break;
        default:
            break;
        }
        return type;
    }

    public String getDescription() {
        String desc = "";
        switch (value) {
        case 1:
            desc = "发动机配件系列";
            break;
        case 2:
            desc = "制动零部件系列";
            break;
        case 3:
            desc = "汽车电器系列";
            break;
        case 4:
            desc = "汽车底盘";
            break;
        case 5:
            desc = "汽车车身";
            break;
        default:
            break;
        }
        return desc;
    }

    @Override
    public String toString() {
        return getDescription();
    }

    public boolean equals(PartTypeEnumEntity type) {
        if (type == null) {
            return false;
        }
        return this.value == type.value;
    }

    public int getValue() {
        return value;
    }
}
